13.5. Cono circolare retto e coniche#

13.5.1. Equazione del cono#

Equazioni del (doppio) cono circolare retto, usando un sistema di coordinate cartesiane con origine nel vertice e asse coincidente con l’asse \(z\),

\[C: \ x^2 + y^2 = d^2 z^2 \ .\]
Hide code cell source
import numpy as np
import plotly.graph_objects as go



#> Parameters
y0, y1, ny, yinit =  -.5,  .5, 11, .0
z0, z1, nz, zinit =  -.5,  .5, 11, .0
t0, t1, nt, tinit = -90., 90., 19, .0 
dcone = .8

dy = ( y1 - y0 ) / ( ny - 1 )
dz = ( z1 - z0 ) / ( nz - 1 )
dt = ( t1 - t0 ) / ( nt - 1 )

#> Cone
# Local coordinates for the cone
u = np.linspace(0, 2 * np.pi, 100)  # Angle in the xy-plane (0 to 2pi)
v = np.linspace(-1, 1, 21)          # Height of the cone from apex (0 to 1)
u, v = np.meshgrid(u, v)

x = dcone * v * np.cos(u)  # x-coordinate
y = dcone * v * np.sin(u)  # y-coordinate
z = v                      # z-coordinate (height of the cone)

# Local coordinates for the plane
u_plane = np.linspace(-2, 2, 5)
v_plane = np.linspace(-2, 2, 5)
u_plane, v_plane = np.meshgrid(u_plane, v_plane)

x_plane = u_plane                           # x-coordinate
y_plane = yinit + v_plane * np.cos(tinit)   # y-coordinate
z_plane = zinit + v_plane * np.sin(tinit)   # z-coordinate (height of the cone)


#> Figure
layout = dict(
               width=500, height=500,
               paper_bgcolor='white',
               plot_bgcolor='white',
               scene = dict(
                   xaxis=dict(title='X', range=[-1,1]),
                   yaxis=dict(title='Y', range=[-1,1]),
                   zaxis=dict(title='Z', range=[-1,1]),
               ),
)

data_cone = go.Surface(
    z=z, x=x, y=y,
    surfacecolor=np.full_like(z, 1),
    colorscale=[[0, 'rgba(0, 0, 255, 0.3)'], [1, 'rgba(0, 0, 255, 0.3)']],  # Blue with alpha
    showscale=False,  # No color scale bar
    # colorscale='Viridis',
    opacity=0.7
)

data_plane = go.Surface(
    z=z_plane, x=x_plane, y=y_plane,
    surfacecolor=np.full_like(z_plane, 1),  # Plane color (white)
    colorscale=[[0, 'rgba(255, 0, 0, 0.5)'], [1, 'rgba(255, 0, 0, 0.5)']],  # White with some transparency
    showscale=False,  # No color scale bar
    opacity=0.5  # Set opacity for the plane
)

fig = go.Figure(layout=layout)
fig.add_trace(data_cone,)

int_active = 3
int_steps  = 5
int_values = np.arange(int_steps)

zv = z0 + np.arange(int_steps)*dz

for z in zv:
    
    #> Evaluate points of the plane
    yp, zp, tp = yinit, z, tinit
    x_p = u_plane                     # x-coordinate
    y_p = yp + v_plane * np.cos(tp)   # y-coordinate
    z_p = zp + v_plane * np.sin(tp)   # z-coordinate (height of the cone)

    #> Add trace
    fig.add_trace(
        go.Surface(
            visible=False,
            x=x_p, y=y_p, z=z_p
        )           
    )

#> Sliders - w/o using widgets
int_active = 3
int_steps  = 5
int_values = np.arange(int_steps)

base_traces = 1
traces_per_step = 1
int_steps = []
for i in range(0, int_values.shape[0]):
    visarray = [False] * len(fig.data)
    visarray[0:base_traces] = [True] * base_traces
    curr_idx = int(base_traces +  i    * traces_per_step)
    next_idx = int(base_traces + (i+1) * traces_per_step)
    visarray[curr_idx:next_idx] = [True] * traces_per_step
    step = dict(
        method = 'update',
        args=[{'visible': visarray}],
    )
    int_steps.append(step)

print(f"visarray: {visarray}")

#> Initial conditions
for i in range(traces_per_step):
    curr_idx = int_active
    fig.data[1+curr_idx].visible = True

#> Layout
int_slider = dict(active=int_active, steps=int_steps)
sliders = [int_slider]

fig.update_layout(
    sliders=sliders,
)

fig.show()
visarray: [True, False, False, False, False, True]

13.5.2. Coniche: intersezione tra cono e piano#

Si prende un punto \(P\) nel piano \(y,z\), \(P-O = y_P \hat{y} + z_P \hat{z}\), e il piano \(\pi\) passante per il punto \(P\) con versore normale \(\hat{n} = \sin \theta \, \hat{y} - \cos \theta \, \hat{z}\). Si introduce quindi un altro sistema di coordinate cartesiane \(X,Y,Z\) con origine nel punto \(P\), con asse \(Z\) allineato con il versore normale \(\hat{n}\) e l’asse \(X\) allineato con l’asse \(x\), così che le trasformazioni dei versori dei due sistemi di riferimento sono

\[\begin{split} \begin{aligned} \hat{X} & = \hat{x} \\ \hat{Y} & = \hat{y} \cos \theta + \hat{z} \sin \theta \\ \hat{Z} & =-\hat{y} \sin \theta + \hat{z} \cos \theta \\ \end{aligned} \qquad , \qquad \begin{aligned} \hat{x} & = \hat{X} \\ \hat{y} & = \hat{Y} \cos \theta - \hat{Z} \sin \theta \\ \hat{z} & = \hat{Y} \sin \theta + \hat{Z} \cos \theta \\ \end{aligned} \end{split}\]

e tra le coordinate

\[\begin{split} \begin{aligned} X & = \ \ \ x \\ Y & = \ \ \ (y-y_P) \cos \theta + \hat{z} (z-zP) \theta \\ Z & = - (y-y_P) \sin \theta + \hat{z} (z-zP) \theta \\ \end{aligned} \qquad , \qquad \begin{aligned} x & = X \\ y - y_P & = Y \cos \theta - Z \sin \theta \\ z - z_P & = Y \sin \theta + Z \cos \theta \\ \end{aligned} \end{split}\]

L’equazione del piano \(\pi\) nel sistema di coordinate \(X,Y,Z\) è semplicemente \(\pi: \ Z = 0\). I punti di interesezione tra il cono e il piano si trovano mettendo a sistema le equazioni delle due superfici,

\[\begin{split}\begin{cases} \pi: & Z = 0 \\ C: & \ X^2 + (y_p + Y \cos \theta - Z \sin \theta )^2 = d^2 ( z_P + Y \sin \theta + Z \cos \theta )^2 \end{cases}\end{split}\]

e quindi l’equazione dell’intersezione \(\gamma := \pi \cap C\) è

\[\begin{split}\begin{aligned} \gamma: & \ X^2 + (y_P + Y \cos \theta )^2 = d^2 ( z_P + Y \sin \theta )^2 \\ & \ X^2 + Y^2 ( \cos^2 \theta - d^2 \sin^2 \theta ) + Y ( 2 y_P \cos \theta - 2 d^2 z_P \sin \theta ) + y_P^2 - d^2 z_P^2 = 0 \\ \end{aligned}\end{split}\]

o ancora, con il completamento del quadrato, nell’ipotesi che \(\cos^2 \theta - d^2 \sin^2 \theta \ne 0\) (caso della parabola trattato in seguito)

\[\begin{split}\begin{aligned} \ X^2 + Y^2 ( \cos^2 \theta - d^2 \sin^2 \theta ) + 2 Y ( y_P \cos \theta - d^2 z_P \sin \theta ) + \frac{( y_P \cos \theta - d^2 z_P \sin \theta )^2}{ \cos^2 \theta - d^2 \sin^2 \theta } & = \frac{( y_P \cos \theta - d^2 z_P \sin \theta )^2}{ \cos^2 \theta - d^2 \sin^2 \theta }- y_P^2 + d^2 z_P^2 \\ \ X^2 + ( \cos^2 \theta - d^2 \sin^2 \theta ) \left[ Y + \frac{ y_P \cos \theta - d^2 z_P \sin \theta}{ \cos^2 \theta - d^2 \sin^2 \theta } \right]^2 & = \frac{ y_P^2 \cos^2 \theta - 2 d^2 z_P y_P \cos \theta \sin \theta + d^4 z_P^2 \sin^2 \theta - y_P^2 \cos^2 \theta + y^2 d^2 \sin^2 \theta + d^2 z_P^2 \cos^2 \theta - d^4 z_P^2 \sin^2 \theta}{ \cos^2 \theta - d^2 \sin^2 \theta } \\ \ X^2 + ( \cos^2 \theta - d^2 \sin^2 \theta ) \left[ Y + \frac{ y_P \cos \theta - d^2 z_P \sin \theta}{ \cos^2 \theta - d^2 \sin^2 \theta } \right]^2 & = \frac{ - 2 d^2 z_P y_P \cos \theta \sin \theta + y_P^2 d^2 \sin^2 \theta + d^2 z_P^2 \cos^2 \theta }{ \cos^2 \theta - d^2 \sin^2 \theta } \\ \ X^2 + ( \cos^2 \theta - d^2 \sin^2 \theta ) \left[ Y + \frac{ y_P \cos \theta - d^2 z_P \sin \theta}{ \cos^2 \theta - d^2 \sin^2 \theta } \right]^2 & = d^2 \frac{( y_P \sin \theta - z_P \cos \theta )^2 }{ \cos^2 \theta - d^2 \sin^2 \theta } \\ \end{aligned}\end{split}\]

Questa è l’equazione dell’intersezione generica tra un piano e un doppio cono. Si analizzano ora alcuni casi particolari, in funzione dell’angolo \(\theta\) e della posizione del punto \(P\).

  • Se \(\theta = 0\), il piano è normale all’asse del doppio cono, si ottiene l’equazione

    \[X^2 + (Y + y_P)^2 = d^2 z_P^2 \ ,\]

    che rappresenta una circonferenza centrata nel punto di coordinate \((X, Y) = (0, -y_P)\), che corrisponde al punto di interesezione dell’asse del cono con il piano \(\pi\). Se \(z_P = 0\) si trova il caso degenere di circonferenza con raggio nullo, o un punto solo in corrispondenza del vertice del doppio cono

  • Se \(\theta = \theta_p\) tale che \(\tan \theta_p = \mp \frac{1}{d}\), allora il coefficiente di \(Y^2\) è nullo e l’equazione

    \[X^2 + 2 \left(y_P \cos \theta_p - z_P \frac{\cos^2 \theta_p}{\sin \theta_p} \right) Y + y_P^2 - \frac{\cos^2 \theta_p}{\sin^2 \theta_p} z_P^2 = 0 \ ,\]

    rappresenta una parabola con \(Y\) come asse di simmetria.

  • Per valori di \(\theta\) diversi, l’equazione dell’intersezione diventa

    \[ \frac{\cos^2 \theta - d^2 \sin^2 \theta }{d^2 ( y_P \sin \theta - z_P \cos \theta )^2 } X^2 + \frac{( \cos^2 \theta - d^2 \sin^2 \theta )^2}{d^2 ( y_P \sin \theta - z_P \cos \theta )^2} \left[ Y + \frac{ y_P \cos \theta - d^2 z_P \sin \theta}{ \cos^2 \theta - d^2 \sin^2 \theta } \right]^2 = 1 \ , \]

    cioè l’equazione di:

    • un’ellisse, se \(\cos^2 \theta - d^2 \sin^2\theta > 0\), cioè se \(\theta \in (0, \theta_p)\), con semi-assi

      \[\begin{split}\begin{aligned} a & = \frac{| d ( y_P \sin \theta - z_P \cos \theta )| }{\sqrt{\cos^2 \theta - d^2 \sin^2 \theta} } \\ b & = \frac{| d ( y_P \sin \theta - z_P \cos \theta )| }{\cos^2 \theta - d^2 \sin^2 \theta} \\ \end{aligned}\end{split}\]

      e centro \(X = 0\), \(Y = - \frac{ y_P \cos \theta - d^2 z_P \sin \theta}{ \cos^2 \theta - d^2 \sin^2 \theta }\)

    • un’iperbole, se \(\cos^2 \theta - d^2 \sin^2 \theta <0\), cioè se \(\theta > \theta_p\), con semi-asse maggiore \(b\) allineato lungo \(Y\), e semi-asse minore \(a\) lungo \(X\),

      \[\begin{split}\begin{aligned} a & = \frac{| d ( y_P \sin \theta - z_P \cos \theta )| }{\sqrt{ - \cos^2 \theta + d^2 \sin^2 \theta} } \\ b & = \frac{| d ( y_P \sin \theta - z_P \cos \theta )| }{- \cos^2 \theta + d^2 \sin^2 \theta} \\ \end{aligned}\end{split}\]